package com.example.springboot.entity;

import javax.persistence.*;
import java.io.Serializable;

@Entity//注解指明这是一个和数据库表映射的实体类
@Table(name = "user") //实体类映射表名
public class User {
    private int uid;
    private int account;
    private String name;
    private String email;
    private String headimg;
    private String phone;
    private char gender;
    private Integer type;

    @Id //这个注解指明这个属性为数据库中的主键
    @Column(name = "uid") //映射数据库中的字段
    @GeneratedValue(strategy=GenerationType.IDENTITY) //使用主键的生成方式为自动增长
    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    @Basic
    @Column(name = "account")
    public int getAccount() {
        return account;
    }

    public void setAccount(int account) {
        this.account = account;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "email")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "headimg")
    public String getHeadimg() {
        return headimg;
    }

    public void setHeadimg(String headimg) {
        this.headimg = headimg;
    }

    @Basic
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Basic
    @Column(name = "gender")
    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    @Basic
    @Column(name = "type")
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public User(int uid, int account, String name, String email, String headimg, String phone, char gender, Integer type) {
        this.uid = uid;
        this.account = account;
        this.name = name;
        this.email = email;
        this.headimg = headimg;
        this.phone = phone;
        this.gender = gender;
        this.type = type;
    }

    public User( int account) {
        this.account = account;
    }

    public User() {
    }
}
